<!--视图设计组件-->
<template>
  <div id="viewDesign">
    <el-row style="margin: 10px 0px 20px 20px">
      <el-col :span="24">
        <el-button type="success" icon="el-icon-document">导出</el-button>
        <el-button type="success" icon="el-icon-view" @click="preview">预览</el-button>
      </el-col>
    </el-row>
    <el-input style="margin: 0px 10px 20px 20px; width: 97%" type="textarea" autosize
              v-model="toChildrenData.sql"></el-input>
    <el-table
      v-if="show"
      :data="toChildrenData.tableData"
      border
      style="margin: 0px 10px 20px 20px; width: 96%">
      <el-table-column
        v-for="(item) in toChildrenData.columns"
        :key="item.prop"
        :prop="item.prop"
        :label="item.label">
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
  export default {
    name: "viewDesign",
    props: {},
    data() {
      return {
        show: false
      }
    },
    methods: {
      preview() {
        // 传输sql语句给父组件
        this.$parent

        // 表显示
        this.show = true
      }
    }
  }
</script>

<style scoped>
  #viewDesign {
    width: 100%;
    height: 100%;
  }
</style>
